<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul id="mylist">
        <li>Coffee</li>
        <li>Tea</li>
    </ul>
    <button onclick="myFunctopm()">点我</button>
    <script>
        function myFunctopm() {
            var newItem = document.createElement("li");
            var textnode = document.createTextNode("water");
            newItem.appendChild(textnode)
            var list = document.getElementById("mylist");
            list.insertBefore(newItem, list.childNodes[0])
        }
    </script>
</body>

</html>